import request from '@/utils/request/request';
import { FileRecordReq } from '@/api/model/fileModel';

// 比价单生成，按计划

// 获得比价单子列表,分页
export function getPlanListForBjd(data: any) {
  return request.post(
    '/api/procurement/require/plan-list/getPlanListForBjd',
    data
  );
}

// 获得比价单子列表,分页
export function page(params: any) {
  return request.get('/api/procurement/require/compare-item/page', {
    params,
  });
}

// 自动预选
export function operation(data: any) {
  return request.post('/api/procurement/require/compare/operation', data);
}

// 生成比价单
export function generate(data: any) {
  return request.post('/api/procurement/require/compare/generate', data);
}

// 退回
export function sheetReturn(data: any) {
  return request.post('/api/procurement/require/compare/return', data);
}

// 提交审批
export function approved(data: any) {
  return request.post('/api/procurement/require/compare/approved', data);
}

// 获得比价单子列表,分页
export function pageForCondition(params: any) {
  return request.get('/api/procurement/require/compare/pageForCondition', {
    params,
  });
}
// 采购计划选商结果查询分页查询
export function supplierList(data: any) {
  return request.post(
    '/api/procurement/require/supplier-chose-result/list',
    data
  );
}

// 采购计划选商结果更新采购价格
export function updateResult(data: any) {
  return request.post(
    '/api/procurement/require/supplier-chose-result/updateResult',
    data
  );
}

// 采购计划选商结果退回
export function fallback(data: any) {
  return request.post(
    '/api/procurement/require/supplier-chose-result/fallback',
    data
  );
}

// 修改比价单
export function putCompare(data: any) {
  return request.put('/api/procurement/require/compare-item', data);
}

// put请求
export function updateScsProductDetail(data: any) {
  return request.put('/api/scs/product-reverse', data);
}

// get请求
export function getScsProductDetail(id: any) {
  return request.get(`/api/scs/product-reverse/${id}`);
}

// 文件上传
export function importQuoteExcel(data: FormData, params: FileRecordReq) {
  return request.post('/api/pms/quote/importQuoteExcel', data, {
    params,
    headers: {
      'Content-Type': 'application/form-data',
    },
  });
}

// 前端税率、转换系数相关计算
export function execCalculate(data: any) {
  return request.post(
    '/api/procurement/require/supplier-chose-result/execTaxCalculate',
    data
  );
}
